#pragma once
#include<iostream>
#include"MyLinkList.h"
#include<fstream>
#include<vector>
using namespace std;

struct AVLNode
{
	MyLinkList _ml;
	char *_word;
	int count;
	int Bal; // he so can bang (0 1 2)

	AVLNode *Pleft;
	AVLNode *PRight;
};


typedef AVLNode* TreeAVL;

class AVLTree
{
	
public:
	void Init(TreeAVL &t);
	AVLNode *CreateNode( char*c, MyLinkList &ll, int n);
	int InsertNode(TreeAVL &t,char *c,int position);
	void RNL(TreeAVL &t, ofstream &out);
	void LeftRotate(TreeAVL &t);
	void RightRotate(TreeAVL &t);
	void LeftBlance(TreeAVL &t);
	void RightBlance(TreeAVL &t);
	
	void ReplaceString(TreeAVL &t,vector<char*>&aaaa, vector<char*>&_liststring, vector<char*>&_listtring2, ofstream &of);
	AVLTree(void);
	~AVLTree(void);
};

